package com.zhongke.cotrun.model.pojo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 分页
 *
 * @author xiangdai
 */
@Data
@ApiModel(value="包装类",description="包装类")
public class PageQueryRequest implements Serializable {

    @ApiModelProperty(value = "起始页", name = "起始页", example = "1", dataType = "int")
    private int pageIndex = 1;

    @ApiModelProperty(value = "分页大小", name = "分页大小", example = "20", dataType = "int")
    private int pageSize = 20;

    private int startIndex;

    public void checkQueryParam() {
        this.startIndex = this.pageIndex <= 0 ? 0 : (this.pageIndex - 1) * this.pageSize;
    }
}
